Subscribe Us

Responsive Advertisement

Advertisement

URI Online Judge | 1168 LED solution in cpp

 uri 1168 solution in cpp

by ujjal roy




#include<bits/stdc++.h>

using namespace std;

main()

{

    int n;

    string s;

    cin>>n;

    while(n--)

    {

        int r=0;

        cin>>s;

        for(int i=0;i<s.size();i++)

        {

            if(s[i]=='0'||s[i]=='9'||s[i]=='6') r+=6;

            else if(s[i]=='2'||s[i]=='3'||s[i]=='5') r+=5;

            else if(s[i]=='1') r+=2;

            else if(s[i]=='4') r+=4;

            else if(s[i]=='8') r+=7;

            else if(s[i]=='7') r+=3;


        }

        cout<<r<<" leds"<<endl;

    }


    return 0;

}


Post a Comment

0 Comments